﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="List.aspx.cs" MasterPageFile="~/Master/HomeMaster.Master"
    Inherits="CSP.Web.MyHome.ServiceInfo.List" %>

<asp:Content ID="CSPHead" ContentPlaceHolderID="CSPHead" runat="server">
    <meta charset="utf-8">
    <title>地理位置管理</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">
</asp:Content>
<asp:Content ID="CSPStyleAndScript" ContentPlaceHolderID="CSPStyleAndScript" runat="server">
    <link href="/Styles/lib/jquery-ui/jquery-ui-1.8.22.custom.css" rel="stylesheet" type="text/css" />
    <link href="/Styles/lib/jquery-ui/jquery.ui.button.css" rel="stylesheet" type="text/css" />
    <script src="/Scripts/UI/Jquery/jquery.ui.core.js" type="text/javascript"></script>
    <script src="/Scripts/UI/Jquery/jquery.ui.widget.min.js" type="text/javascript"></script>
    <script src="/Scripts/UI/Jquery/jquery.ui.position.min.js" type="text/javascript"></script>
    <script src="/Scripts/UI/Jquery/jquery.ui.dialog.js" type="text/javascript"></script>
    <script src="/Scripts/UI/Expand/dialog.js" type="text/javascript"></script>
    <script language="javascript">


        function DeleteInfo(id) {
            DialogMessage.ConfirmShow("提示", "确定要删除此条信息？", function () {
                $.ajax({
                    type: "get",
                    dataType: "json",
                    //data: { OrderNumber: ordernumber, ShipmentID:shipmentID, Notes: notes, Action: "CancelShipmentByID" },
                    url: "List.aspx?deleteid=" + id,
                    async: false,
                    error: function (result) {
                        result;
                    },
                    success: function (data, textStatus) {
                        data;
                        //执行成功
                        if (data.status == 1) {
                            DialogMessage.Show(1, data.msg, function () {
                                window.location.href = "List.aspx";
                            });
                        }
                        else if (data.status == 2)//警告
                        {
                            DialogMessage.Show(2, data.msg);
                        }
                        else {
                            DialogMessage.Show(0, data.msg);
                        }
                    }
                });
            });
        }

        function UpdateStatus(id, status) {
            var statusName = "上线";
            if (status == 1) {
                statusName = "下线";
            } else if (status == 2) {
                statusName = "上线";
            }
            DialogMessage.ConfirmShow("提示", "确定要更新为" + statusName + "状态", function () {
                $.ajax({
                    type: "get",
                    dataType: "json",
                    url: "List.aspx?updateid=" + id + "&status=" + status,
                    async: false,
                    error: function (result) {
                        result;
                    },
                    success: function (data, textStatus) {
                        data;
                        //执行成功
                        if (data.status == 1) {
                            DialogMessage.Show(1, data.msg, function () {
                                window.location.href = "List.aspx";
                            });
                        }
                        else if (data.status == 2)//警告
                        {
                            DialogMessage.Show(2, data.msg);
                        }
                        else {
                            DialogMessage.Show(0, data.msg);
                        }
                    }
                });
            });
        }

        //获取时间
        function GetLastTime(obj, sencond) {

            var sysSecond = sencond;
            if (sysSecond > 0) {
                sysSecond = sysSecond - 1;
                var second = Math.floor(sysSecond % 60);             // 计算秒     
                var minite = Math.floor((sysSecond / 60) % 60);      //计算分 
                var hour = Math.floor((sysSecond / 3600) % 24);      //计算小时 
                var day = Math.floor((sysSecond / 3600) / 24);        //计算天 

                obj.title = day + "天" + hour + "小时" + minite + "分" + second + "秒";
            } else {//剩余时间小于或等于0的时候，就停止间隔函数 
                obj.title = "0秒";
            }
        }
    </script>
</asp:Content>
<asp:Content ID="CSPCrumbs" ContentPlaceHolderID="CSPCrumbs" runat="server">
    <div class="crumbs">
        <span>您当前所在的位置：</span> <a href="/">首页</a> &gt; <a href="/MyHome/ServiceOrder/List.aspx">我是服务者</a> &gt; <span>发布课程管理</span>
    </div>
    <!--crumbs-->
    <!--crumbs-->
</asp:Content>
<asp:Content ID="CSPRight" ContentPlaceHolderID="CSPRight" runat="server">
 <div class="pr10">
    <div class="pr10 mh500">
        <div class="tabs tabs-home mt10">
            <div class="tabs-nd">
                <ul class="tabs-hd">
                    <li class="trigger current">发布课程管理</li>
                </ul>
            </div>
            <div class="tabs-bd order">
                <div class="tabs-panel">
                    <div class="thead mt10">
                        <asp:DropDownList ID="S_Status" OnTextChanged="S_Status_SelectedIndexChanged" AutoPostBack="true"
                            runat="server">
                            <asp:ListItem Value="" Text="全部"></asp:ListItem>
                            <asp:ListItem Value="0" Text="未曾上线"></asp:ListItem>
                            <asp:ListItem Value="2" Text="上线"></asp:ListItem>
                            <asp:ListItem Value="1" Text="下线"></asp:ListItem>
                        </asp:DropDownList>
                        <span class="order-search fr">
                            <input type="text" id="Txt_Title" runat="server" class="text" placeholder="输入合作标题/合作编号/服务者名称">
                            <input type="submit" id="Btn_Search" class="submit" runat="server" onserverclick="Btn_Search_Click"
                                value="查询">
                        </span>
                    </div>
                    <!--thead-->
                    <p style="margin-top: 20px; text-align: right;">
                        <a href="ServiceType.aspx" class="ui-btn-big sl-rc"><span class="sl-rc-cnt">+发布新服务</span></a></p>
                    <asp:Repeater ID="R_ServiceInfo" ViewStateMode="Disabled" runat="server">
                        <HeaderTemplate>
                            <table width="100%" border="0" cellpadding="0" cellspacing="0" class="table-style mtb15">
                                <thead>
                                    <tr>
                                        <th width="12%" scope="col">
                                            序号
                                        </th>
                                        <th width="31%" align="left" scope="col">
                                            服务标题
                                        </th>
                                        <th width="26%" align="left" scope="col">
                                            服务类别
                                        </th>
                                        <th width="19%" align="left" scope="col">
                                            发布状态
                                        </th>
                                        <th width="12%" scope="col">
                                            操作
                                        </th>
                                    </tr>
                                </thead>
                                <tbody>
                        </HeaderTemplate>
                        <ItemTemplate>
                            <tr>
                                <td height="80" align="center">
                                    <%#Container.ItemIndex+1 %>
                                </td>
                                <td>
                                    <h3 class="title">
                                        <a href="/detail/<%#Eval("Id") %>.shtml">
                                            <%# Eval("Title") %></a></h3>
                                </td>
                                <td>
                                    <%# GetServiceTypeName(Eval("ServiceInfoServiceTypeRels[0].ServiceTypeId").ToString())%>
                                </td>
                                <td align="left">
                                    <strong class="fc-red">
                                        <%# GetServiceInfoStatus(Eval("Status").ToString())%></strong><p>
                                            <span title="" style='display: <%#Eval("Status").ToString()=="2"?"block":"none" %>'
                                                onmouseover="GetLastTime(this,<%# GetLastSecond(Eval("OnLineTime")==null?"1900-1-1":Eval("OnLineTime").ToString()) %>)">
                                                上线时间<br />
                                                <%# Convert.ToDateTime(Eval("OnLineTime")==null?"1900-1-1":Eval("OnLineTime").ToString()).ToString("yyyy-MM-dd HH:mm:ss") %></span>
                                        </p>
                                </td>
                                <td align="center" class="operate">
                                    <a href="javascript:UpdateStatus(<%#Eval("Id") %>,<%#Eval("Status").ToString()=="1"||Eval("Status").ToString()=="0"?"2":"1" %>)">
                                        <%#GetOperateName(Eval("Status").ToString())%></a><br>
                                    <a href="Modify.aspx?id=<%#Eval("Id") %>">编辑</a><br>
                                    <a href="javascript:DeleteInfo(<%#Eval("Id") %>);">删除</a>
                                </td>
                            </tr>
                        </ItemTemplate>
                        <FooterTemplate>
                            <tr>
                                <td colspan="5" style="text-align: center">
                                    <asp:Label ID="LB_Empty" runat="server" Text=""><%=R_ServiceInfo.Items.Count == 0 ? "暂无数据" : ""%></asp:Label>
                                </td>
                            </tr>
                            </tbody> </table>
                        </FooterTemplate>
                    </asp:Repeater>
                    <!-- {{{ pagination -->
                    <div style="text-align:right;display:<%=R_ServiceInfo.Items.Count == 0 ? "none" : "block"%>" align="right" >
                        <!-- pagination }}} -->
                        <CSP_U:CSPPager ID="U_ServicePager" AutoPostBack="true" runat="server" OnIndexChange="U_ServicePager_IndexChange" />
                    </div>
                </div>
                <!--tabs-panel-->
            </div>
            <!--tabs-bd-->
        </div>
        <!--tabs-->
    </div>
</div>
</asp:Content>
